<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
		<style type="text/css">
			span{
				display:inline-block;
				color:deepskyblue;
				margin-top:10px;
				}
		</style>
		<script type="text/javascript" src="../../jQuery/jquery-3.4.1.js"></script>
		<script type="text/javascript">
			$(function(){
				$("#txt").keyup(function(){
					var str=$(this).val().toString();
					$("#num").text(str.length);
				});
			})
		</script>
	</head>
	<body>
		<input type="text" id="txt">
		<div>字符串长度为：<span id="num">0</span></div>
	</body>
</html>
